package logic

import (
	"context"
	"merchantmanager/models/mysql"

	"merchantmanager/merchantmanagerrpc/internal/svc"
	"merchantmanager/merchantmanagerrpc/merchantmanagerrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type MerchantmanagerShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewMerchantmanagerShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MerchantmanagerShowLogic {
	return &MerchantmanagerShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 详情
func (l *MerchantmanagerShowLogic) MerchantmanagerShow(in *merchantmanagerrpc.MerchantmanagerShowRequest) (*merchantmanagerrpc.MerchantmanagerShowResponse, error) {
	// todo: add your logic here and delete this line

	var merchants mysql.Merchants
	mysql.DB.Debug().Where("id = ?", in.Id).Find(&merchants)

	return &merchantmanagerrpc.MerchantmanagerShowResponse{
		Id:    int64(merchants.ID),
		Name:  merchants.Name,
		Types: merchants.Types,
		Time:  merchants.Time,
	}, nil
}
